package gpschallenge.componentes.utililidades;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;

public abstract class XML {

	public static void guardarObjeto(Object objeto, String url)
			throws FileNotFoundException {
		XStream xstream = new XStream(new DomDriver());
		PrintWriter unPrint = null;
		unPrint = new PrintWriter(url);
		xstream.toXML(objeto, unPrint);
		unPrint.close();
	}

	public static Object obtenerObjeto(String url) {
		XStream xstream = new XStream(new DomDriver());
		File file = new File(url);
		Object objetoJuego = xstream.fromXML(file);
		return objetoJuego;
	}

}
